/////////////////////////////////////////////////////////////////////////
//
// Amuse Engine SDK
// Copyright (c) 2014.  All Rights Reserved
//
// File:		simdConfig.h
// Author:		Gianluca Belardelli
// Date:		07/01/2014
//
/////////////////////////////////////////////////////////////////////////
#ifndef _SIMDCONFIG_H_
#define _SIMDCONFIG_H_

#define AE_CONFIG_SIMD_ENABLED 1	// Estensioni SIMD abilitate
#define AE_CONFIG_SIMD_DISABLED 2	// Estensioni SIMD disabilitate

// Decommentare la riga seguente per forzare l'utilizzo della sola FPU
//#define AE_CONFIG_SIMD AE_CONFIG_SIMD_ENABLED

#ifndef AE_CONFIG_SIMD
	// win32
	#if defined(AE_PLATFORM_WIN32)
		#define AE_CONFIG_SIMD AE_CONFIG_SIMD_ENABLED
	// AMD x64
	#elif defined(AE_ARCH_X64)
		#define AE_CONFIG_SIMD AE_CONFIG_SIMD_ENABLED
	// Linux
	#elif defined(AE_PLATFORM_LINUX)
		#define AE_CONFIG_SIMD AE_CONFIG_SIMD_ENABLED
	// Mac
	#elif defined(AE_PLATFORM_MAC386) 
		#define AE_CONFIG_SIMD AE_CONFIG_SIMD_DISABLED
	// Ios
	#elif defined(AE_PLATFORM_IOS) 
		#ifdef AE_COMPILER_HAS_INTRINSICS_NEON // ARMv7 (Cortex A8, Cortex A9 etc)
			#define AE_CONFIG_SIMD AE_CONFIG_SIMD_ENABLED
		#else // ARMv6 etc
			#define AE_CONFIG_SIMD AE_CONFIG_SIMD_DISABLED
		#endif
	// Android 
	#elif defined(AE_PLATFORM_ANDROID)
		#ifdef AE_COMPILER_HAS_INTRINSICS_NEON // ARMv7 (Cortex A8, Cortex A9 etc)
			#define AE_CONFIG_SIMD AE_CONFIG_SIMD_ENABLED //HK_CONFIG_SIMD_ENABLED
		#else // ARMv6 etc
			#define AE_CONFIG_SIMD AE_CONFIG_SIMD_DISABLED
		#endif
	#else
		#error Piattaforma non specificata
		#define AE_CONFIG_SIMD AE_CONFIG_SIMD_DISABLED
	#endif
#else // ifndef AE_CONFIG_SIMD
	#if (AE_CONFIG_SIMD != AE_CONFIG_SIMD_ENABLED) && (AE_CONFIG_SIMD != AE_CONFIG_SIMD_DISABLED)
		#error Configurazione SIMD invalida.
	#endif
#endif // ifndef AE_CONFIG_SIMD

#ifdef __GCCXML__
// Per GccXml le Simd non sono attivate
#define AE_CONFIG_SIMD AE_CONFIG_SIMD_DISABLED
#endif

#define AE_SSE_VERSION 0x41
// 0x20 SSE2
// 0x30 SSE3
// 0x31 SSSE3
// 0x40 SSE4 (AES)
// 0x41 SSE4.1
// 0x42 SSE4.2
// 0x50 AVX
// 0x51 FMA

#endif // _SIMDCONFIG_H_
